<?php
class User extends AppModel {
	var $name = 'User';
	var $displayField = 'first_name';
	var $validate = array(
		'email' => array(
			'email' => array(
				'rule' => array('email'),
				'message' => 'Proszę podać poprawny adres e-mail',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'unique' => array(
				'rule' => 'isUnique',
		        'message' => 'Podany adres jest już w naszej bazie'
	        )
		),
		'password' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Pole nie może być puste.'
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'repeat_password' => array(
					'notempty' => array(
						'rule' => array('notempty'),
						'message' => 'Pole nie może być puste.'
			//'allowEmpty' => false,
			//'required' => false,
			//'last' => false, // Stop validation after this rule
			//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),		
	
// 		'first_name' => array(
// 			'notempty' => array(
// 				'rule' => array('notempty'),
// 				'message' => 'This field cannot be left blank'

// 			),
// 		),
// 		'last_name' => array(
// 			'notempty' => array(
// 				'rule' => array('notempty'),
// 				'message' => 'This field cannot be left blank'

// 			),
// 		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $hasMany = array(
		'Ogloszenia' => array(
			'className' => 'Ogloszenia',
			'foreignKey' => 'user_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
